/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Deal.PersonalInformation.View;

import Deal.ItemsCreater.Items_Book;
import Deal.ViewController.ViewController;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author LiuBole
 */
public class PurchaseHistoryJPanel extends javax.swing.JPanel {

    private ViewController viewController;
    private DefaultTableModel historyTable = new DefaultTableModel(null, Items_Book.ORDER_COLUMN_NAME);
    /**
     * Creates new form PurchaseHistoryJPanel
     */
/*    public PurchaseHistoryJPanel() {
        initComponents();
    }*/
    public PurchaseHistoryJPanel(ViewController controller) {
        initComponents();
        viewController = controller;
        initData();
    }
    
    private void initData(){
        this.historyTable.setDataVector(viewController.orderTableVector("id"), Items_Book.ORDER_COLUMN_NAME);
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable(){
            public boolean isCellEditable(int row, int column){
                return false;
            }
        };

        jTable1.setModel(historyTable);
        jScrollPane1.setViewportView(jTable1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 493, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 372, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
}
